
package com.netease.xone.widget;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;

import com.netease.xone.R;

public class BannerIndicator extends AbsIndicator {

    private Drawable mIndBmp;
    private Drawable mHighlightBmp;
    private int mCount;

    public BannerIndicator(Context context) {
        this(context, null);
    }

    public BannerIndicator(Context context, AttributeSet attrs) {
        super(context, attrs);
        mIndBmp = context.getResources().getDrawable(R.drawable.shape_banner_indicator);
        mHighlightBmp = context.getResources().getDrawable(R.drawable.shape_banner_indicator_on);
        mIndBmp.setBounds(0, 0, mIndBmp.getIntrinsicWidth(), mIndBmp.getIntrinsicHeight());
        mHighlightBmp.setBounds(0, 0, mHighlightBmp.getIntrinsicWidth(),
                mHighlightBmp.getIntrinsicHeight());
    }

    public void setCount(int count) {
        mCount = count;
    }

    @Override
    public int getCount() {
        return mCount;
    }

    @Override
    public Drawable getIndicator() {
        return mIndBmp;
    }

    @Override
    public Drawable getHighlight() {
        return mHighlightBmp;
    }

    public void clear() {
        mIndBmp = null;
        mHighlightBmp = null;
    }
}
